﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Domain.RBAC
{
    /// <summary>
    /// 角色权限关联表
    /// 原实体名: Rolepermissionmiddle
    /// 修改后实体名: RolePermission (保持类名不变以兼容现有代码)
    /// </summary>
    [SugarTable("rolepermissionmiddle", TableDescription = "角色权限中间表")]
    public class Rolepermissionmiddle : BaseEntity
    {
        /// <summary>
        /// 角色ID（外键关联角色表）
        /// 原字段名: Roleid
        /// 修改后字段名: RoleId
        /// 用途：标识权限所属的角色
        /// </summary>
        [SugarColumn(ColumnDescription = "角色ID", IsNullable = false)]
        public long RoleId { get; set; }

        /// <summary>
        /// 权限ID（外键关联权限表）
        /// 原字段名: Permissionid
        /// 修改后字段名: PermissionId
        /// 用途：标识角色拥有的具体权限
        /// </summary>
        [SugarColumn(ColumnDescription = "权限ID", IsNullable = false)]
        public long PermissionId { get; set; }

        /// <summary>
        /// 授权人姓名（冗余字段）
        /// 新增字段
        /// 用途：提高查询性能，避免频繁关联用户表
        /// </summary>
        [SugarColumn(ColumnDescription = "授权人姓名", Length = 50, IsNullable = true)]
        public string? GranterName { get; set; }

        /// <summary>
        /// 备注信息
        /// 新增字段
        /// 用途：记录授权原因或其他说明信息
        /// </summary>
        [SugarColumn(ColumnDescription = "备注", Length = 500, IsNullable = true)]
        public string? Remark { get; set; }
    }
}
